package com.hadoop.code.rpc;

import com.hadoop.code.rpc.ClientProtocol;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.ipc.RPC;

import java.io.IOException;
import java.net.InetSocketAddress;

/**
 * @author ruimeng
 * @create 2021-11-24 13:46
 * 客户端代码
 **/
public class RPCClient {
    public static void main(String[] args) throws IOException {
        ClientProtocol namenode = RPC.getProxy(ClientProtocol.class,
                1234L,
                new InetSocketAddress("localhost",9999),
                new Configuration());
        //调用协议（接口中的方法），最终是服务端执行
        namenode.makeDir("/user/opt/soft");
        namenode.say("haha");
    }
}
